import java.util.Arrays;
import java.util.HashSet;

public class 移除未排序的 {
    public static void main(String[] args) {
        int[] arr=new int[]{1,2,3,1,2};
        if(arr.length<0||arr.length>20000){
            System.out.println ("输入的字符串长度不正确，请重新输入");
            return;
        }
        HashSet<Integer> set=new HashSet<> ();
        //若排序就用TreeSet
        //TreeSet<Integer> set=new TreeSet<> ();
        System.out.println (Arrays.toString (arr));
        for (int i=0; i < arr.length; i++) {
            set.add (arr[i]);
        }
        System.out.println (set);
        /*HashSet<Character> hm=new HashSet<> ();
        for (int i=0; i <str.length () ; i++) {
            char c=str.charAt (i);
            if(!hm.contains (c)){
                hm.add (c);
            }else {
                continue;
            }
         }
        System.out.println (hm);*/
        }
    }
